#include<bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin >> t;
	while (t--) {
		vector<int> in(10);
		vector<vector<int>> mp(10, vector<int>(10));
		for (int i = 1; i <= 5; i++) {
			int a, b;
			cin >> a >> b;
			in[a]++, in[b]++;
			mp[a][b] = mp[b][a] = 1;
		}

		int mx = *max_element(in.begin(), in.end());

		if (mx == 4)
			cout << "2,2-dimethylbutane" << endl;
		else if (mx == 3) {

			int cnt = 0;
			for (int i : in)
				if (i == 3)
					cnt++;
			if (cnt == 2) {
				cout << "2,3-dimethylbutane" << endl;
				continue;
			}

			cnt = 0;
			for (int i = 1; i <= 6; i++) {
				if (in[i] == 3) {
					for (int j = 1; j <= 6; j++) {
						if (mp[i][j])
							cnt += in[j];
					}
					if (cnt == 4) {
						cout << "2-methylpentane" << endl;
						break;
					} else {
						cout << "3-methylpentane" << endl;
						break;
					}
				}
			}
		} else {
			cout << "n-hexane" << endl;
		}
	}
	return 0;
}
